Gesture Recognizer
Table of Contents

手势冲突

常会遇到手势冲突的问题,可以通过下面几个办法来解决手势冲突问题

// otherGestureRecognizer 执行失败, gestureRecognizer 才会执行
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRequireFailureOfGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer{
    return NO;
}

//gestureRecognizer 失败了 otherGestureRecognizer 才会执行
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldBeRequiredToFailByGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer{
    return YES;
}
- (void)requireGestureRecognizerToFail:(UIGestureRecognizer *)otherGestureRecognizer;

// [A requireGestureRecognizerToFail:B];
// B 手势失败了才会执行 A 手势,跟第一个代理类似